const path = require('path')
var baseUrl = '/'
module.exports = {
  baseUrl,
  chainWebpack: (config) => {
    // 解决在linux中 打包报循环依赖的问题
    config.plugin('html').tap(args => {
      args[0].chunksSortMode = 'none'
      return args
    })

    config.resolve.alias
      .set('@', path.resolve(__dirname, 'src/'))
      .set('public', path.resolve(__dirname, 'public/'))
      .set('vue$', 'vue/dist/vue.esm.js')

    config.module
      .rule('svg-icon')
      .test(/\.(svg)(\?.*)?$/)
      .include
      .add([path.resolve(__dirname, 'src/icons'), path.resolve(__dirname, 'src/common/plugins/svgIcon/icons')])
      .end()
      .use('svg-sprite-loader')
      .loader('svg-sprite-loader')
      .options({
        symbolId: 'icon-[name]'
      })
    config.module
      .rule('svg')
      .exclude
      .add([path.resolve(__dirname, 'src/icons'), path.resolve(__dirname, 'src/common/plugins/svgIcon/icons')])
  },
  productionSourceMap: false
}